using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Antlr3.ST.Language;
using Antlr3.ST;
using System.IO;


namespace TplTest {
	/// <summary>
	/// Summary description for finalpage.
	/// </summary>
	partial class finalpage : System.Web.UI.Page {

	
		private void Page_Load(object sender, System.EventArgs e) {
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e) {
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent() {    
			this.Load += new System.EventHandler(this.Page_Load);
			this.Label1.Text="asasa";

            //StringTemplate a = new StringTemplate("$user.name$, $user.phone$");
            //Hashtable user = new Hashtable();
            //user.Add("name", "Terence");
            //user.Add("phone", "none-of-your-business");
            //a.SetAttribute("user", user);
            //string results = a.ToString();
            //Response.Write(results);

            StringTemplate st = new StringTemplate(FileHelp.Read("1.tp"));
            st.SetAttribute("name", "your word");
            Response.Write(st.ToString());


		}
		#endregion
	}

    public class FileHelp
    {
        public static string Read(string filename)
        {

            filename = HttpContext.Current.Server.MapPath("tpl/" + filename);
            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                StreamReader sr = new StreamReader(fs);
                return sr.ReadToEnd();
            }

        }
    }
}
